package cn.ithers.blog.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author: zhanghuan
 * @date: 2020/8/28 18:31
 * @description:
 */
public class ValidatetUtils {

    public static final String regEx = "^([a-z0-9A-Z]+[-|\\.]?)+[a-z0-9A-Z]@([a-z0-9A-Z]+(-[a-z0-9A-Z]+)?\\.)+[a-zA-Z]{2,}$";

    /**
     * 邮箱校验
     *
     * @param emailAddress
     * @return
     */
    public static boolean isEmailAddressOk(String emailAddress) {

        Pattern p = Pattern.compile(regEx);
        Matcher m = p.matcher(emailAddress);
        return m.matches();
    }
}
